#pragma once
#ifndef __MCSELECTCONTROLLER_H_
#define __MCSELECTCONTROLLER_H_

#include <MCMouseReceiver.h>
#include <IKeyArgs.h>
#include <vector>
#include <MCGripPoint.h>

class IGraphicsItem;
class ICanvas;

class MCSelectController : public MCMouseReceiver
{
public:

    MCSelectController(ICanvas *presenter);

    void onMouseDown(IMouseArgs &args) override;
    void onMouseUp(IMouseArgs &args) override;
    void onMouseMove(IMouseArgs &args) override;
    void onKeyDown(IKeyArgs &args);

    const std::vector<IGraphicsItem *> &selections();
    const std::vector<MCGripPoint *> &selectedGripPoints();

private:

    void addSelection(IGraphicsItem *item);
    void removeFromSelections(IGraphicsItem *item);
    void deselectAll();
    void deleteSelections();
    void unhoverAll();

private:

    ICanvas *_presenter;

    std::vector<IGraphicsItem *> _selections;
    std::vector<MCGripPoint *> _selectedGrips;

    bool _mouseMoved;
};

#endif // !__MCSELECTCONTROLLER_H_
